package com.chenwei.rabbit.singleQueue;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author: chenwei
 * @date: 2021/4/1 18:02
 */
@Component("singleCustomer")
//value-队列名称   durable-是否持久化   autoDelete-是否自动删除队列
@RabbitListener(queuesToDeclare = @Queue(value = "singleQueue",durable = "false",autoDelete = "false"))
public class Customer {

    @RabbitHandler
    public void getMsg(String message){
        System.out.println("接收到的消息："+message);
    }
}
